package com.itheima.service.impl;

import com.alibaba.dubbo.config.annotation.Service;
import com.itheima.mapper.UserMapper;
import com.itheima.pojo.Permission;
import com.itheima.pojo.Role;
import com.itheima.pojo.User;
import com.itheima.service.UserService;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;
@Service(version = "1.0",interfaceClass = UserService.class)
@Transactional
public class UserServiceImpl implements UserService {
    @Resource
    private UserMapper userMapper;

    @Override
    public User find() {
        return userMapper.find();
    }

    @Override
    public User findUserByUsername(String username) {
        return userMapper.findUserByUsername(username);
    }

    @Override
    public List<Role> findRoleListByUserId(Long userId) {
        return userMapper.findRoleListByUserId(userId);
    }

    @Override
    public List<Permission> findPermissionByRoleId(Integer roleId) {
        return userMapper.findPermissionByRoleId(roleId);
    }
}
